home *** CD-ROM | disk | FTP | other *** search
- // Label Plug In
- //
- // © 1996 Now Software, Inc
- // written by: hac
-
- #include "Main.h"
-
- MenuHandle gLabelMenu;
-
- pascal void main(PlugInInformation *plugInInformation)
- {
- plugInInformation->version = kPlugInInformationVersionOne;
- plugInInformation->plugInType = kLabelPlugInType;
- plugInInformation->PrepareMenu = &PrepareMenu;
- plugInInformation->CleanUpAfterMenuSelect = &CleanUpAfterMenuSelect;
- plugInInformation->HandleSubMenuItemSelected = &HandleSubMenuItemSelected;
- }
-
- pascal void PrepareMenu(InstantAccessInformation *information, short asPreview)
- {
- MenuItemInformation menuItem;
- short menuID;
- MenuHandle menu;
- long menuSize;
-
-
- BlockMove("\pLabel", menuItem.text, kMenuItemTextSize);
-
- menu = (*information->FindMenu)("\pLabel");
- if (menu != nil)
- {
- menuSize = GetHandleSize((Handle)menu);
-
- gLabelMenu = (MenuHandle)NewHandle(menuSize);
- if (gLabelMenu != nil)
- {
- BlockMove(*menu, *gLabelMenu, menuSize);
-
- menuID = (*information->GetAvailableSubMenuID)();
- (*gLabelMenu)->menuID = menuID;
-
- InsertMenu(gLabelMenu, -1);
-
- menuItem.version = kMenuItemInformationVersionOne;
- menuItem.classification = kMiscellaneousClassification;
- menuItem.type = kTextMenuItemType;
- menuItem.id = 1;
- menuItem.enabled = true;
- menuItem.style = 0;
- menuItem.mark = 0;
- menuItem.hasSubMenu = true;
- menuItem.subMenu = gLabelMenu;
- menuItem.refCon = 0;
- menuItem.owningPlugInType = kLabelPlugInType;
-
- (*information->AddMenuItem)(&menuItem);
- }
- }
- }
-
- pascal void CleanUpAfterMenuSelect(InstantAccessInformation *information, short asPreview)
- {
- DeleteMenu((*gLabelMenu)->menuID);
- DisposeMenu(gLabelMenu);
- }
-
- pascal void HandleSubMenuItemSelected(InstantAccessInformation *information, short menuID, short menuItemNumber)
- {
- Str255 text;
-
- GetMenuItemText(gLabelMenu, menuItemNumber, text);
- (*information->SelectFinderMenuItem)("\pLabel", text);
- }
-